<template v-show="this.$route.meta">
  <div class="change-container shadow roundy-20">
    <header>
      <div class="title">密码修改</div>
    </header>
    <div>
      <LoginInput class="input"  title="请输入原本的密码" type="password" v-model="input.oldPassword"/>
      <LoginInput class="input"  title="请输入新的密码" type="password" v-model="input. newPassword"/>
      <LoginInput class="input"  title="请再次输入新密码" type="password" v-model="input.newPassword1"/>
    </div>
    <div class="btn">
      <LoginButton style="margin-top: 20px;" title="确认修改" @click="editpassword()" />
    </div>
    
  </div>
</template>

<script>

import LoginButton from '../Others/LoginButton.vue';
import LoginInput from '../Others/LoginInput.vue';
import request from '@/utils/request';
export default {
  name: 'UserChange',
  props:['user'],
  components:{
    LoginButton,
    LoginInput,
  },
  data(){
    return{
      input:{ //用户输入
        oldPassword: '',  //原来的密码
        newPassword: '',  //新的密码
        newPassword1: '',  //再次输入新的密码
      },
/*       form:
      {
        userid:0,
        password:''

      } */
    }
  },
  methods:
  {
    editpassword()
    { 
      /* this.form.userid=id;
      console.log(this.form) */
      request.post("/api/start/edit/password", {userId:this.user?.userId, password: this.input.newPassword}).then(res => {
        if (res.code === 200) {
          this.$message({
            message: '操作成功',
            type: 'success'
          });
        } else {
          this.$message({
            message: res.msg,
            type: 'error'
          });
        }
      })

    }


  }
}
</script>
<style scoped>
.change-container {
  padding: 20px;
  height: 600px;
  width: 500px;
  background-color: white;
  margin: 0px auto;
  padding-top: 50px;
  box-sizing: border-box;
}


.userImgBar {
  height: 100px;
  width: 100px;
  background-color: brown;
}

.title {
  font-size: 30px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 50px;
}

header {
  margin-bottom: 20px;
}

.input {
  margin-top: 30px;
  margin-bottom: 30px;
  margin-left: auto;
  margin-right: auto;
}

.btn {
  text-align: center;
}
</style>
